<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui-2.4.2/src/css/layui.css">
    <script type="text/javascript" src="/jquery/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/layui-2.4.2/src/layui.js"></script>
</head>
<body>
    <div>
        <div class="layui-row">
            <table id="popular_route__order_view" lay-filter="popular_route__order_filter">
            </table>
        </div>
    </div>

</body>
<script>
    layui.use(['element','table','upload','laytpl','form'], function() {
        var table=layui.table;
        table.render({
            elem:'#popular_route__order_view',
            url:'/popularRouteOrder/queryList',
            page:true,
            size:10,
            limits:[10,20,50,100],
            cols:[
                [
                    {field:'orderSn',title:'订单编号'},
                    {field:'name',title:'用户名称'},
                    {field:'mobile',title:'联系电话'},
                    {field:'payMoney',title:'总金额'},
                    {field:'type',title:'支付方式',templet:function(d){
                        if(d.type===null || d.type==='')return "";
                        if(d.type===1)return 'RMB';
                        if(d.type===2)return 'FMT';
                    }},
                    {field:'actualPayMoney',title:'实际支付金额'},
                    {field:'routeName',title:'路线名称'},
                    {field:'modelName',title:'车型名称'},
                    {field:'orderStatus',title:'订单状态',templet:function(d){
                        if(d.orderStatus===1)return '待支付';
                        if(d.orderStatus===2)return '待确认';
                        if(d.orderStatus===3)return '已发货';
                        if(d.orderStatus===4)return '已完成';
                        if(d.orderStatus===5)return '超时取消';
                    }},
                    {field:'right',align:'center',title:'操作',toolbar:'#toolOper'}

                ]
            ],
            response:{
                status:'errorCode',
                countName:'total',
                dataName:'data'
            }
        });

        table.on('tool(popular_route__order_filter)',function(obj){
            var data=obj.data;
            var layEvent=obj.event;

            $.ajax({
                type:'get',
                data:{'orderId':data.orderId,status:4,userId:data.userId},
                url:'/popularRouteOrder/updateStatus',
                cache:false,
                success:function (data) {
                    $(".layui-laypage-btn").click();
                }
            });
        });
    });
</script>
<script type="text/html" id="toolOper">

    {{#  if(d.orderStatus == 2){ }}
    <a class="layui-btn layui-btn-xs" lay-event="success">确认</a>
    {{#  } }}
</script>
</html>